<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>积分对换记录管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/score/exchangeRecord/">积分对换记录列表</a></li>
		<shiro:hasPermission name="score:exchangeRecord:edit"><li><a href="${ctx}/score/exchangeRecord/form">积分对换记录添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="exchangeRecord" action="${ctx}/score/exchangeRecord/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>姓名：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
		<label>手机：</label><form:input path="member.mobile" htmlEscape="false" maxlength="50" class="input-medium"/>
		<label class="control-label" style="margin-top:3px;">开始时间:</label>
				
					<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
					<input id="createTime" name="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${exchangeRecord.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>  
<label class="control-label" style="margin-top:3px;">结束时间:</label>
					<input id="endTime" name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${exchangeRecord.endTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
		
		<br><br>
		<%-- <label>分值：</label><form:input path="member.score" htmlEscape="false" maxlength="50" class="input-medium"/> --%>
		<label>状态：</label>
		<select name="status"  class="input-medium">
			<option value="">全部</option>
			<option value="0">未使用</option>
			<option value="1">已兑换</option>
			<option value="2">已作废</option>
		</select>
		<c:if test="${flag eq '0' }">
			<label>来源：</label>
			<form:select path="type" class="input-medium">
					<form:option value="0">商家</form:option>
					<form:option value="1">微购物</form:option>
			</form:select>
		</c:if>
		
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr>
		<shiro:hasPermission name="sys:user:edit"><th>所属商家</th></shiro:hasPermission>
		<th>奖品名称</th>
		<th>兑换者姓名</th><th>手机号</th><th>兑换分值</th>
		<th>状态</th>
		<%-- <th>有效时间</th><th>核销时间</th>  --%>
		<shiro:hasPermission name="score:exchangeRecord:edit">
		<th>操作</th>
		</shiro:hasPermission>
		</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="exchangeRecord">
		
		
			<c:if test="${exchangeRecord.exchange.iskou eq 1}">
				<c:set var="exr" value="exchangeRecord"></c:set>
			<tr>
				<shiro:hasPermission name="sys:user:edit"><td> ${exchangeRecord.user.name} </td></shiro:hasPermission>
				<td title="${exchangeRecord.qrCode.content }"> ${exchangeRecord.name} </td>
				<td>${exchangeRecord.member.name}</td>
				<td>${exchangeRecord.member.mobile}</td>
				<td>${exchangeRecord.costScore}</td>
				<td>
				<c:if test="${exchangeRecord.status == 1 }">已兑换</c:if> <c:if test="${exchangeRecord.status == 0 }">未使用<c:if test="${exchangeRecord.valid eq false }">-<b style="color:red">已过期</b></c:if></c:if>
					 <c:if test="${exchangeRecord.status == 2 }">已作废</c:if>
				</td>
				<td>
    				<c:if test="${exchangeRecord.valid eq true }"><a class="btn btn-primary" href="${ctx}/score/exchangeRecord/update?id=${exchangeRecord.id}&status=1">核销</a></c:if>
				</td>
				<%-- <td>${exchangeRecord.createTime}<br>${exchangeRecord.endTime}</td>
				<td title="${exchangeRecord.remarks}">${exchangeRecord.updateTime}</td> --%>
				<%-- <shiro:hasPermission name="score:exchangeRecord:edit"><td>
				<c:if test="${exchangeRecord.status == 0 }">
    				<c:if test="${exchangeRecord.valid eq true }"><a class="btn btn-primary" href="${ctx}/score/exchangeRecord/update?id=${exchangeRecord.id}&status=1">核销</a></c:if>
    				<a  class="btn btn-info" href="${ctx}/score/exchangeRecord/update?id=${exchangeRecord.id}&status=2">作废</a>
    				<a class="btn btn-warning" href="${ctx}/score/exchangeRecord/form?id=${exchangeRecord.id}">修改</a>
					<a  class="btn btn-danger"href="${ctx}/score/exchangeRecord/delete?id=${exchangeRecord.id}" onclick="return confirmx('确认要删除该积分对换记录吗？', this.href)">删除</a>
    			</c:if>
				 <c:if test="${exchangeRecord.status == 1 }">
    				<a  class="btn btn-info" href="${ctx}/score/exchangeRecord/update?id=${exchangeRecord.id}&status=2">作废</a>
					<a  class="btn btn-danger"href="${ctx}/score/exchangeRecord/delete?id=${exchangeRecord.id}" onclick="return confirmx('确认要删除该积分对换记录吗？', this.href)">删除</a>
    			</c:if>
    			
				</td></shiro:hasPermission> --%>
			</tr>
            </c:if>
			
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
